<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('电子名片报告查询记录列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <label>客户名称：</label>
                            <input type="text" name="cname"/>
                        </li>
                        <li>
                            <label>证件号码：</label>
                            <input type="text" name="idNo"/>
                        </li>
                        <li>
                            <label>客户类型：</label>
                            <select name="custType" class="selectpicker"
                                    th:with="type=${@dict.getType('credit_target')}">
                                <option value="">所有</option>
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                                        th:value="${dict.dictValue}"></option>
                            </select>
                        </li>
                        <li class="select-date">
                            <label>查询时间：</label>
                            <input type="text" class="time-input" id="startTime" placeholder="开始时间"
                                   name="params[beginTime]"/>
                            <span>-</span>
                            <input type="text" class="time-input" id="endTime" placeholder="结束时间"
                                   name="params[endTime]"/>
                        </li>
                        <li>
                            <label>查询机构：</label>
                            <input type="text" name="deptId"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-success" onclick="add()" shiro:hasPermission="statistics:queryReport:add">
                <i class="fa fa-plus"></i> 添加
            </a>
            <a class="btn btn-warning" onclick="$.table.exportExcel()"
               shiro:hasPermission="statistics:queryReport:export">
                <i class="fa fa-download"></i> 导出
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var custTypeDatas = [[${@dict.getType('credit_target')}]];
    var prefix = ctx + "statistics/queryReport";
    $(function () {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            exportUrl: prefix + "/export",
            modalName: "电子名片报告查询记录",
            columns: [{
                checkbox: true
            },
                {
                    field: 'id',
                    title: '编号',
                    visible: false
                },
                {
                    field: 'cname',
                    title: '客户名称'
                },
                {
                    field: 'idNo',
                    title: '证件号码'
                },
                {
                    field: 'custType',
                    title: '客户类型',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(custTypeDatas, value);
                    }
                },
                {
                    field: 'qurtyTime',
                    title: '查询时间'
                },
                {
                    field: 'userName',
                    title: '查询人'
                },
                {
                    field: 'deptName',
                    title: '查询机构'
                },
                {
                    field: 'reportUrl',
                    title: '报告路径',
                    align: 'center',
                    formatter: function (value, row, index) {
                        return $.table.imageView(row.reportUrl, 300, 500, 'blank');
                    }
                }]
        };
        $.table.init(options);
    });

    /*新建客户*/
    function add() {
        var url = prefix + "/add"
        top.layer.open({
            type: 2,
            area: [400 + 'px', 450 + 'px'],
            fix: false,
            //不固定
            maxmin: true,
            shade: 0.3,
            title: "报告查询",
            content: url,
            btn: ['确定', '关闭'],
            // 弹层外区域关闭
            shadeClose: false,
            yes: function (index, layero) {
                var iframeWin = layero.find('iframe')[0];
                iframeWin.contentWindow.submitHandler(index, layero);
            },
            cancel: function (index) {
                return true;
            }
        });
    }
</script>
</body>
</html>